package com.shangcheng.goods.dao;

import com.shangcheng.goods.pojo.Sku;
import com.shangcheng.goods.pojo.Spu;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface SpuMapper extends Mapper<Spu> {
    @Select("SELECT* FROM tb_spu WHERE brand_id =#{id}")
    List<Spu> selectById(int id);

    @Update("UPDATE tb_spu SET  shoucang=#{username} WHERE  id=#{id}")
    int addSC(@Param("username") String username, @Param("id") String id);

    @Update("UPDATE tb_spu SET  shoucang=null WHERE  id=#{id}")
    int deleteSC(@Param("id") String id);

    @Select("SELECT* FROM tb_spu WHERE is_marketable LIKE#{isMarketable}")
    List<Spu> findPageIsMarketable(String isMarketable);

    @Select("SELECT* FROM tb_spu WHERE status LIKE#{status}")
    List<Spu> selectByStatus(String status);
}